<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="Ubuntu 18.04 SeaFile + 阿里云 OSS 部署私人网盘, 湮灭星空,博客,Python,后端">
    <meta name="description" content="Ubuntu 18.04 SeaFile + 阿里云 OSS 部署私人网盘
准备
安装依赖
安装 Seafile 服务器之前，请确认已安装以下软件:
For Seafile 7.0.x
# on Ubuntu 16.04
apt-get u">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>Ubuntu 18.04 SeaFile + 阿里云 OSS 部署私人网盘 | 湮灭星空</title>
    <link rel="icon" type="image/png" href="/favicon.png">

    <link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.css">
    <link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
    <link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
    <link rel="stylesheet" type="text/css" href="/css/matery.css">
    <link rel="stylesheet" type="text/css" href="/css/my.css">

    <script src="/libs/jquery/jquery.min.js"></script>

<link rel="alternate" href="/atom.xml" title="湮灭星空" type="application/atom+xml">
</head>

<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper head-container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">湮灭星空</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友链</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>

<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">湮灭星空</div>
        <div class="logo-desc">
            
            天下寥寥，苍生涂涂，诸子百家，唯我纵横
            
        </div>
    </div>

    

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友链
		</a>
          
        </li>
        
        
    </ul>
</div>

        </div>

        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/15.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <div class="description center-align post-title">
                        Ubuntu 18.04 SeaFile + 阿里云 OSS 部署私人网盘
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
<style>
    #articleContent h1::before,
    #articleContent h2::before,
    #articleContent h3::before,
    #articleContent h4::before,
    #articleContent h5::before,
    #articleContent h6::before {
        display: block;
        content: " ";
        height: 100px;
        margin-top: -100px;
        visibility: hidden;
    }

    #articleContent :focus {
        outline: none;
    }

    .toc-fixed {
        position: fixed;
        top: 64px;
    }

    .toc-widget {
        padding-left: 20px;
    }

    .toc-widget .toc-title {
        margin: 35px 0 15px 0;
        padding-left: 17px;
        font-size: 1.5rem;
        font-weight: bold;
        line-height: 1.5rem;
    }

    .toc-widget ol {
        padding: 0;
        list-style: none;
    }

    #toc-content ol {
        padding-left: 10px;
    }

    #toc-content ol li {
        padding-left: 10px;
    }

    #toc-content .toc-link:hover {
        color: #42b983;
        font-weight: 700;
        text-decoration: underline;
    }

    #toc-content .toc-link::before {
        background-color: transparent;
        max-height: 25px;
    }

    #toc-content .is-active-link {
        color: #42b983;
    }

    #toc-content .is-active-link::before {
        background-color: #42b983;
    }

    #floating-toc-btn {
        position: fixed;
        right: 15px;
        bottom: 76px;
        padding-top: 15px;
        margin-bottom: 0;
        z-index: 998;
    }

    #floating-toc-btn .btn-floating {
        width: 48px;
        height: 48px;
    }

    #floating-toc-btn .btn-floating i {
        line-height: 48px;
        font-size: 1.4rem;
    }
</style>
<div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/tags/mysql/">
                                <span class="chip bg-color">mysql</span>
                            </a>
                        
                            <a href="/tags/%E9%98%BF%E9%87%8C%E4%BA%91/">
                                <span class="chip bg-color">阿里云</span>
                            </a>
                        
                            <a href="/tags/ubuntu/">
                                <span class="chip bg-color">ubuntu</span>
                            </a>
                        
                            <a href="/tags/seafile/">
                                <span class="chip bg-color">seafile</span>
                            </a>
                        
                            <a href="/tags/oss/">
                                <span class="chip bg-color">oss</span>
                            </a>
                        
                            <a href="/tags/%E7%A7%81%E4%BA%BA%E7%BD%91%E7%9B%98/">
                                <span class="chip bg-color">私人网盘</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/categories/Tech/" class="post-category">
                                Tech
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2020-02-05
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2020-02-12
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    1.4k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    6 分
                </div>
                
				
                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
            
        </div>
        <hr class="clearfix">
        <div class="card-content article-card-content">
            <div id="articleContent">
                <h1 id="ubuntu-18-04-seafile-阿里云-oss-部署私人网盘"><a class="header-anchor" href="#ubuntu-18-04-seafile-阿里云-oss-部署私人网盘"></a>Ubuntu 18.04 SeaFile + 阿里云 OSS 部署私人网盘</h1>
<h2 id="准备"><a class="header-anchor" href="#准备"></a>准备</h2>
<h3 id="安装依赖"><a class="header-anchor" href="#安装依赖"></a>安装依赖</h3>
<p>安装 Seafile 服务器之前，请确认已安装以下软件:</p>
<p><strong>For Seafile 7.0.x</strong></p>
<pre><code class="language-shell"># on Ubuntu 16.04
apt-get update
apt-get install python2.7 python-setuptools python-mysqldb python-urllib3 python-ldap -y
</code></pre>
<p>官方文档：<a href="https://cloud.seafile.com/published/seafile-manual-cn/deploy/using_mysql.md" target="_blank" rel="noopener">部署 Seafile 服务器（使用 MySQL/MariaDB）</a></p>
<h3 id="挂载-oss"><a class="header-anchor" href="#挂载-oss"></a>挂载 OSS</h3>
<p>ossfs能让您在Linux系统中，将对象存储OSS的存储空间（Bucket）挂载到本地文件系统中，您能够像操作本地文件一样操作OSS的对象（Object），实现数据的共享。（<a href="https://help.aliyun.com/document_detail/32196.html" target="_blank" rel="noopener">阿里官方文档</a>）</p>
<h4 id="下载安装包"><a class="header-anchor" href="#下载安装包"></a>下载安装包</h4>
<pre><code class="language-shell">wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_ubuntu18.04_amd64.deb?spm=a2c4g.11186623.2.13.5a037358uShggJ&amp;file=ossfs_1.80.6_ubuntu18.04_amd64.deb
</code></pre>
<h4 id="安装-ossfs"><a class="header-anchor" href="#安装-ossfs"></a>安装 ossfs</h4>
<pre><code class="language-shell">sudo apt-get update
sudo apt-get install gdebi-core
sudo gdebi your_ossfs_package # 就是上一步下载的安装包
</code></pre>
<h4 id="配置账号访问信息"><a class="header-anchor" href="#配置账号访问信息"></a>配置账号访问信息</h4>
<p>将 <code>Bucket</code>名称以及具有此<code>Bucket</code>访问权限的<code>AccessKeyId</code>/<code>AccessKeySecret</code>信息存放在<code>/etc/passwd-ossfs</code>文件中。注意这个文件的权限必须正确设置，建议设为<code>640</code>。</p>
<pre><code class="language-shell">sudo vi /etc/passwd-ossfs
</code></pre>
<p>文件内写入（一个 Bucket 写一行，多个 Bucket 分多行写，本文只需要一个 Bucket）：</p>
<pre><code class="language-shell">BucketName1:AccessKeyId1:AccessKeySecret1
BucketName2:AccessKeyId2:AccessKeySecret2
BucketName3:AccessKeyId3:AccessKeySecret3
....
</code></pre>
<p>将 <code>/etc/passwd-ossfs</code>文件的权限改为 <code>640</code>：</p>
<pre><code class="language-shell">sudo chmod 640 /etc/passwd-ossfs
</code></pre>
<p>新建一个目录，这个目录就是阿里云 OSS 即将挂载到的目录，目录位置可以随便选，建议在 <code>~/</code> 目录下</p>
<pre><code class="language-shell">cd ~
mkdir ossfs
cd ossfs
mkdir klause-seafile
</code></pre>
<h4 id="将bucket挂载到指定目录"><a class="header-anchor" href="#将bucket挂载到指定目录"></a>将Bucket挂载到指定目录</h4>
<p><strong>最重要的一步：将 OSS 挂载到该目录下</strong>，使用以下命令：</p>
<blockquote>
<p>不能直接照官方文档上面的来，不然安装的时候可能会出现没有访问权限的问题。</p>
<p>首先先看一下用户id，以我的是root为例，可以使用 <code>id root</code> 命令查看 <code>root</code> 用户的 <code>uid</code>、<code>gid</code></p>
</blockquote>
<pre><code class="language-shell">sudo ossfs BucketName  ~/ossfs/klause-seafile -ourl=my-oss-endpoint -ouid=0 -ogid=0 -o allow_other -o umask=007
</code></pre>
<ul>
<li><code>BucketName</code>：Bucket 的名字</li>
<li><code>~/ossfs/klause-seafile</code> ：OSS 要挂载的目录</li>
<li><code>uid</code>：指定用户的 <code>uid</code></li>
<li><code>gid</code>：指定用户的 <code>gid</code></li>
<li><code>-ourl=</code> ：是阿里云 OSS 所在地区的<strong>外网Endpoint</strong>，可以在阿里云帮助文档<a href="https://help.aliyun.com/document_detail/31837.html?spm=a2c4g.11186623.2.18.3f767358gJLEAt#concept-zt4-cvy-5db" target="_blank" rel="noopener">访问域名和数据中心</a>查看</li>
<li><code>allow_other</code>：表示允许其他用户访问</li>
<li><code>umask</code>：设置挂载文件夹的权限，默认设置 <code>777</code>，会被提示不安全，挂载为770权限，不知道为啥这里 <code>0</code> 代表 <code>7</code>，<code>7</code> 表示<code>0</code></li>
</ul>
<p>挂载后可以使用 <code>tree</code> 命令查看：</p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-130316.png" alt="image-20200205210316240"></p>
<blockquote>
<p><code>tree</code> 安装命令：<code>sudo apt install tree</code></p>
</blockquote>
<h4 id="卸载-bucket"><a class="header-anchor" href="#卸载-bucket"></a>卸载 Bucket</h4>
<pre><code class="language-shell">sudo umount ~/ossfs # ~/ossfs 是挂载着 OSS Bucket 的目录
</code></pre>
<h4 id="挂载示例"><a class="header-anchor" href="#挂载示例"></a>挂载示例</h4>
<p>挂载示例：将杭州地域名称为<code>bucket-test</code>的Bucket挂载到<code>/tmp/ossfs</code>目录下。</p>
<pre><code class="language-shell">echo bucket-test:LTAIbZcdVCmQ****:MOk8x0y9hxQ31coh7A5e2MZEUz**** &gt; /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
mkdir /tmp/ossfs
ossfs bucket-test /tmp/ossfs -ourl=http://oss-cn-hangzhou.aliyuncs.com
</code></pre>
<h4 id="某次-centos-中挂载遇到的一些问题"><a class="header-anchor" href="#某次-centos-中挂载遇到的一些问题"></a>某次 CentOS 中挂载遇到的一些问题</h4>
<p>如果 <code>sudo ossfs</code> 找不到 <code>ossfs</code> 命令，可以使用 <code>where ossfs</code> 查看 <code>ossfs </code> 命令的路径，比如路径为 <code>/usr/local/bin/ossfs</code> ，然后使用 <code>sudo /usr/local/bin/ossfs</code> 执行命令。</p>
<p>可以使用 <code>-o passwd_file=</code> 指定秘钥文件，而不必须使用 <code>/etc/passwd-ossfs</code> 作为秘钥文件，这样可以避免 <code>/etc/passwd-ossfs</code> 文件因权限无法访问的问题。</p>
<h3 id="配置-nginx"><a class="header-anchor" href="#配置-nginx"></a>配置 NGINX</h3>
<p><strong>7.0.x 版本之后，8000端口默认监听在127.0.0.1地址上，这意味着您无法直接通过8000端口访问Seafile服务。建议您</strong><a href="https://cloud.seafile.com/published/seafile-manual-cn/deploy/deploy_with_nginx.md" target="_blank" rel="noopener"><strong>配置nginx反向代理</strong></a><strong>。</strong></p>
<h4 id="安装-nginx"><a class="header-anchor" href="#安装-nginx"></a>安装 NGINX</h4>
<pre><code class="language-shell">sudo apt install nginx
</code></pre>
<h4 id="配置-nginx"><a class="header-anchor" href="#配置-nginx"></a>配置 NGINX</h4>
<pre><code class="language-shell"># 切换到 NGINX 配置的目录
cd /etc/nginx/conf.d
# 新建一个 seafile.conf 的配置文件
sudo vi seafile.conf
</code></pre>
<p><code>seafile.conf</code> 内将 <code>8900</code> 端口的访问做映射</p>
<ul>
<li><code>/</code>：对根目录的访问转到 <code>seahub server</code>   端口为 <code>8000</code></li>
<li><code>/seafhttp</code> ：对 <code>/seafhttp</code> 路径的访问转到 <code>seafile server</code> 端口为 <code>8082</code></li>
</ul>
<p>具体内容如下（<a href="https://cloud.seafile.com/published/seafile-manual-cn/deploy/deploy_with_nginx.md" target="_blank" rel="noopener">官方示例地址</a>）：</p>
<pre><code class="language-nginx">server {
    listen 8900;
    server_name seafile.example.com;
    proxy_set_header X-Forwarded-For $remote_addr;

    location / { 
         proxy_pass         http://127.0.0.1:8000;
         proxy_set_header   Host $host;
         proxy_set_header   X-Real-IP $remote_addr;
         proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
         proxy_set_header   X-Forwarded-Host $server_name;
         proxy_read_timeout  1200s;
         # used for view/edit office file via Office Online Server
         client_max_body_size 0;
         access_log      /var/log/nginx/seahub.access.log;
         error_log       /var/log/nginx/seahub.error.log;
    }   

    location /seafhttp {
        rewrite ^/seafhttp(.*)$ $1 break;
        proxy_pass http://127.0.0.1:8082;
        client_max_body_size 0;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_connect_timeout  36000s;
        proxy_read_timeout  36000s;
        proxy_send_timeout  36000s;
        send_timeout  36000s;
    }   

    location /media {
        root /home/parallels/seafile_project/seafile-server-latest/seahub;
    }   
}
</code></pre>
<h4 id="检查-nginx-配置"><a class="header-anchor" href="#检查-nginx-配置"></a>检查 NGINX 配置</h4>
<pre><code class="language-shell">sudo nginx -t
</code></pre>
<h4 id="重启-nginx"><a class="header-anchor" href="#重启-nginx"></a>重启 NGINX</h4>
<pre><code class="language-shell">sudo service nginx restart
</code></pre>
<h3 id="配置-mysql"><a class="header-anchor" href="#配置-mysql"></a>配置 MySQL</h3>
<p>在安装前需要确保 Ubuntu 已经正确安装病启动了 MySQL。</p>
<p>如果安装时，因为 MySQL 的原因无法正常安装，建议完全卸载 MySQL，重新安装 MySQL。（方法自行 Google）</p>
<h3 id="下载安装包"><a class="header-anchor" href="#下载安装包"></a>下载安装包</h3>
<p>在 <a href="https://download.seafile.top/d/8c29766a64d24122936f/" target="_blank" rel="noopener">https://download.seafile.top/d/8c29766a64d24122936f/</a> 页面下载最新版本的安装包。</p>
<p>例如下载 <code>seafile-pro-server_7.0.9_x86-64.tar.gz</code> ：</p>
<pre><code class="language-shell">cd ~
wget https://download.seafile.top/d/8c29766a64d24122936f/files/?p=%2Fseafile-pro-server_7.0.9_x86-64.tar.gz&amp;dl=1
</code></pre>
<h3 id="解压安装包"><a class="header-anchor" href="#解压安装包"></a>解压安装包</h3>
<pre><code class="language-shell"># 切换到用户目录
cd ~

# 新建 seafile_project 目录
mkdir seafile_project

# 将安装包移动到 seafile_project 目录
mv seafile-pro-server_7.0.9_x86-64.tar.gz seafile_project

# 进入 seafile_project 目录
cd seafile_project

# 解压安装包
tar xf seafile-pro-server_7.0.9_x86-64.tar.gz

# 新建 installed 目录
mkdir installed

# 将安装包移动到 installed 目录
mv seafile-pro-server_7.0.9_x86-64.tar.gz installed
</code></pre>
<p>进行上面操作之后，目录结构如下：</p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-125642.png" alt="image-20200205205641442"></p>
<h2 id="安装"><a class="header-anchor" href="#安装"></a>安装</h2>
<p>切换到源码目录，执行 <code>setup-seafile-mysql.sh</code> 脚本进行安装：</p>
<pre><code class="language-shell">cd seafile-server-*
./setup-seafile-mysql.sh  #运行安装脚本并回答预设问题
</code></pre>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-131750.png" alt="image-20200205211750467"></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-132356.png" alt="image-20200205212356375"></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-132634.png" alt="image-20200205212634084"></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-132904.png" alt="image-20200205212903373"></p>
<p>切换到 <code>seafile-server-latest</code> 目录：</p>
<pre><code class="language-shell">cd ..
cd seafile-server-latest
</code></pre>
<p>启动 <code>seafile server</code>：</p>
<pre><code class="language-shell">sudo ./seafile.sh start
</code></pre>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-133314.png" alt="image-20200205213314318"></p>
<p>启动 <code>seahub server</code>：</p>
<pre><code class="language-shell">sudo ./seahub.sh start
</code></pre>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-133820.png" alt="image-20200205213820204"></p>
<h2 id="效果展示"><a class="header-anchor" href="#效果展示"></a>效果展示</h2>
<p>使用浏览器访问 <a href="http://192.168.3.19:8900/" target="_blank" rel="noopener">http://192.168.3.19:8900/</a></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-134043.png" alt="image-20200205214043710"></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-140111.png" alt="image-20200205220110996"></p>
<p><img src="https://klause-blog-pictures.oss-cn-shanghai.aliyuncs.com/ipic/2020-02-05-140130.png" alt="image-20200205220129461"></p>
<p>参考文章：</p>
<p><a href="https://www.zhiiker.com/2017/07/12/%E7%AC%94%E8%AE%B0/2017-07-11.%E4%BD%BF%E7%94%A8Seafile+ossfs+oss%E6%90%AD%E5%BB%BA%E5%B1%9E%E4%BA%8E%E8%87%AA%E5%B7%B1%E7%9A%84%E7%A7%81%E6%9C%89%E4%BA%91%E7%9B%98/#%E5%AE%89%E8%A3%85ossfs" target="_blank" rel="noopener">使用Seafile+ossfs+oss搭建属于自己的私有云盘</a></p>

<div id="gitalk-container"></div>
<script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script><link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"><script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

		<script>
		var gitalkConfig = {"clientID":"9eb5bc3ac1e1ff3ddac0","clientSecret":"4b7ae28042282281295075c2bf0c97ff1791cfeb","repo":"HexoBlogComments","owner":"Annihilater","admin":["Annihilater"],"distractionFreeMode":false};
	    gitalkConfig.id = md5(location.pathname);
		var gitalk = new Gitalk(gitalkConfig);
	    gitalk.render("gitalk-container");
	    </script>
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://www.klause.cn" rel="external nofollow noreferrer">湮灭星空</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://www.klause.cn/2020/02/05/ubuntu/ubuntu-seafile-a-li-yun-oss-bu-shu-si-ren-wang-pan/">https://www.klause.cn/2020/02/05/ubuntu/ubuntu-seafile-a-li-yun-oss-bu-shu-si-ren-wang-pan/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="https://www.klause.cn" target="_blank">湮灭星空</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/tags/mysql/">
                                    <span class="chip bg-color">mysql</span>
                                </a>
                            
                                <a href="/tags/%E9%98%BF%E9%87%8C%E4%BA%91/">
                                    <span class="chip bg-color">阿里云</span>
                                </a>
                            
                                <a href="/tags/ubuntu/">
                                    <span class="chip bg-color">ubuntu</span>
                                </a>
                            
                                <a href="/tags/seafile/">
                                    <span class="chip bg-color">seafile</span>
                                </a>
                            
                                <a href="/tags/oss/">
                                    <span class="chip bg-color">oss</span>
                                </a>
                            
                                <a href="/tags/%E7%A7%81%E4%BA%BA%E7%BD%91%E7%9B%98/">
                                    <span class="chip bg-color">私人网盘</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">

<div id="article-share">
    
    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
        </div>
    </div>

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/2020/02/06/mac/macos-ben-di-gua-zai-a-li-yun-oss/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/15.jpg" class="responsive-img" alt="macOS 本地挂载阿里云 OSS">
                        
                        <span class="card-title">macOS 本地挂载阿里云 OSS</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            macOS 本地挂载阿里云 OSS
OSS是阿里云提供的对象存储服务，在申请开通后，可新建buket，挂载到macOS，作为网盘来使用。阿里云OSS提供的客户端为OSSFS，官方宣称可以支持macOS，但是没有提供二进制包，自己编译时碰到一
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2020-02-06
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/Tech/" class="post-category">
                                    Tech
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/mac/">
                        <span class="chip bg-color">mac</span>
                    </a>
                    
                    <a href="/tags/OSS/">
                        <span class="chip bg-color">OSS</span>
                    </a>
                    
                    <a href="/tags/%E9%98%BF%E9%87%8C%E4%BA%91/">
                        <span class="chip bg-color">阿里云</span>
                    </a>
                    
                    <a href="/tags/%E6%8C%82%E8%BD%BD/">
                        <span class="chip bg-color">挂载</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2020/02/05/mysql/ubuntu-mysql-kai-qi-wai-wang-fang-wen-quan-xian/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/3.jpg" class="responsive-img" alt="Ubuntu MySQL 开启外网访问权限">
                        
                        <span class="card-title">Ubuntu MySQL 开启外网访问权限</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            Ubuntu MySQL 开启外网访问权限
设置 MySQL 配置文件
/etc/mysql/my.cnf
找到 bind-address  =127.0.0.1  将其注释掉；//作用是使得不再只允许本地访问；

重启 MySQL
sud
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2020-02-05
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/categories/Tech/" class="post-category">
                                    Tech
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/tags/mysql/">
                        <span class="chip bg-color">mysql</span>
                    </a>
                    
                    <a href="/tags/ubuntu/">
                        <span class="chip bg-color">ubuntu</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>

<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>

    
<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>


<!-- 代码块折行 -->

<style type="text/css">
code[class*="language-"], pre[class*="language-"] { white-space: pre !important; }
</style>

    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            // headingsOffset: -205,
            headingSelector: 'h2, h3, h4, h5, h6'
        });

        // modify the toc link href to support Chinese.
        let i = 0;
        let tocHeading = 'toc-heading-';
        $('#toc-content a').each(function () {
            $(this).attr('href', '#' + tocHeading + (++i));
        });

        // modify the heading title id to support Chinese.
        i = 0;
        $('#articleContent').children('h2, h3, h4, h5, h6').each(function () {
            $(this).attr('id', tocHeading + (++i));
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>



    <footer class="page-footer bg-color">
    <div class="container row center-align">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            <span id="year">年份</span>
            <a href="https://www.klause.cn" target="_blank">湮灭星空</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
            &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                class="white-color">199.2k</span>&nbsp;字
            
            
            
            
            
            
            <span id="busuanzi_container_site_pv">
                |&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;<span id="busuanzi_value_site_pv"
                    class="white-color"></span>&nbsp;次
            </span>
            
            
            <span id="busuanzi_container_site_uv">
                |&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;<span id="busuanzi_value_site_uv"
                    class="white-color"></span>&nbsp;人
            </span>
            
            <br>
            
            <span id="sitetime">载入运行时间...</span>
            <script>
                function siteTime() {
                    window.setTimeout("siteTime()", 1000);
                    var seconds = 1000;
                    var minutes = seconds * 60;
                    var hours = minutes * 60;
                    var days = hours * 24;
                    var years = days * 365;
                    var today = new Date();
                    var startYear = "2019";
                    var startMonth = "6";
                    var startDate = "28";
                    var startHour = "0";
                    var startMinute = "0";
                    var startSecond = "0";
                    var todayYear = today.getFullYear();
                    var todayMonth = today.getMonth() + 1;
                    var todayDate = today.getDate();
                    var todayHour = today.getHours();
                    var todayMinute = today.getMinutes();
                    var todaySecond = today.getSeconds();
                    var t1 = Date.UTC(startYear, startMonth, startDate, startHour, startMinute, startSecond);
                    var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
                    var diff = t2 - t1;
                    var diffYears = Math.floor(diff / years);
                    var diffDays = Math.floor((diff / days) - diffYears * 365);
                    var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
                    var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) /
                        minutes);
                    var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours -
                        diffMinutes * minutes) / seconds);
                    if (startYear == todayYear) {
                        document.getElementById("year").innerHTML = todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffDays + " 天 " + diffHours +
                            " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    } else {
                        document.getElementById("year").innerHTML = startYear + " - " + todayYear;
                        document.getElementById("sitetime").innerHTML = "本站已安全运行 " + diffYears + " 年 " + diffDays +
                            " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
                    }
                }
                setInterval(siteTime, 1000);
            </script>
            
            <br>
            
            <span id="icp"><img src="/medias/icp.png" style="vertical-align: text-bottom;" />
                <a href="http://www.beian.miit.gov.cn" target="_blank">皖ICP备18005729号-1</a>
            </span>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/Annihilater" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:yanmiexingkong@gmail.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>





    <a href="https://twitter.com/" class="tooltipped" target="_blank" data-tooltip="关注我的Twitter: https://twitter.com/" data-position="top" data-delay="50">
        <i class="fab fa-twitter"></i>
    </a>







    <a href="https://www.zhihu.com/" class="tooltipped" target="_blank" data-tooltip="关注我的知乎: https://www.zhihu.com/" data-position="top" data-delay="50">
        <i class="fab fa-zhihu1">知</i>
    </a>



    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>

    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script src="/js/search.js"></script>
<script type="text/javascript">
$(function () {
    searchFunc("/" + "search.xml", 'searchInput', 'searchResult');
});
</script>
    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    <!-- Global site tag (gtag.js) - Google Analytics -->


    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    

    

    
    <script type="text/javascript" src="/libs/background/ribbon-dynamic.js" async="async"></script>
    
    
    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
